package com.imoblife.brainwavestus.user;

import android.app.Activity;
import android.os.Build.VERSION;
import android.view.View;

import com.imoblife.brainwavestus.interfaces.IPayType;
import com.imoblife.brainwavestus.interfaces.IUserAction;
import com.imoblife.brainwavestus.product.Product;
import com.imoblife.brainwavestus.util.MediaUtil;

public class ActionBuy implements IUserAction {
	
	private Activity mActivity;
	private IPayType mPayType;
	
	public ActionBuy(IPayType payType) {
		
		mPayType = payType;
	}
	
	@Override
	public boolean act(Product product) {
		
		if (Integer.parseInt(VERSION.SDK) < 8) {

			if (MediaUtil.checkPlay(mActivity)) {
				return false;
			}
		}
		
		return mPayType.pay(product);
	}

	@Override
	public void setActivity(Activity activity) {
		
		mActivity = activity;
	}

	@Override
	public void setView(View v) {
		
	}

}
